package com.ltkj.ticket.controller;

import com.ltkj.common.core.domain.R;
import com.ltkj.common.core.utils.StringUtils;
import com.ltkj.common.core.web.controller.BaseController;
import com.ltkj.common.core.web.domain.AjaxResult;
import com.ltkj.common.core.web.page.TableDataInfo;
import com.ltkj.common.security.utils.DictUtils;
import com.ltkj.system.api.domain.SysDictData;
import com.ltkj.ticket.domain.dto.TicVenuesFrontQueryDTO;
import com.ltkj.ticket.domain.vo.TicVenuesFrontDetailVO;
import com.ltkj.ticket.domain.vo.TicVenuesFrontQueryVO;
import com.ltkj.ticket.service.ITicVenuesFrontService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author gushaoliang
 * @Date 2023/9/1 8:47
 * @PackageName:com.ltkj.ticket
 * @ClassName: TicVenuesFrontController
 * @Description: TODO
 * @Version 1.0
 */
@Api(tags = "小程序场馆门票")
@RestController
@RequestMapping("/venuesFront")
public class TicVenuesFrontController extends BaseController {
    @Autowired
    private ITicVenuesFrontService ticvenuesFrontService;

    /**
     * 小程序查询场馆信息
     */
    @ApiOperation("小程序查询场馆信息")
    @GetMapping("/searchVenuesFront")
    public TableDataInfo searchVenuesFront(TicVenuesFrontQueryDTO ticVenuesFrontQueryDTO)
    {
        startPage();
        List<TicVenuesFrontQueryVO> list = ticvenuesFrontService.searchVenuesFront(ticVenuesFrontQueryDTO);
        return getDataTable(list);
    }

    @ApiOperation("小程序查询场馆详细信息")
    @PostMapping("/searchVenuesFrontDetail")
    public R<TicVenuesFrontDetailVO> searchVenuesFrontDetail(@RequestBody TicVenuesFrontQueryDTO ticVenuesFrontQueryDTO)
    {

        return R.ok(ticvenuesFrontService.searchVenuesFrontDetail(ticVenuesFrontQueryDTO));
    }
    /**
     * 根据字典类型查询字典数据信息
     */
    @ApiOperation("小程序查看场馆类别")
    @GetMapping(value = "/searchDictData")
    public AjaxResult dictType()
    {
        List<SysDictData> data = DictUtils.getDictCache("other_base_venues_type");
        if (StringUtils.isNull(data))
        {
            data = new ArrayList<SysDictData>();
        }
        return success(data);
    }



}